{extend name="public/base" /}
{block name="header"}
<style type="text/css">
    td{
        padding: 0px;
        width: 105px;
        vertical-align: middle !important;
        text-align: center !important;
        align-items: center !important;
        align-content: center !important;
        margin: 0px;
    }
</style>
{/block}
{block name="main"}
<section class="scrollable padder">
    <ul class="breadcrumb no-border no-radius b-b b-light pull-in">
        <li><a><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">会员管理</li>
        <li class="active">会员关系图</li>
    </ul>
    <div class="row">
        <div class="col-sm-12">
            <section class="panel panel-default">
                <header class="panel-heading"> 会员关系图</header>
                <div class="panel-body">
                    <form id="search-form1"  class="form-inline" role="form" method="post" onsubmit="return false">
                        <div class="form-group">
                            <input type="text" id="id" name="id" class="form-control" placeholder="编号">
                        </div>
                        <button class="btn btn-success" type="submit" onclick="push($('#id').val())">筛选</button>
                        <a href="javascript:history.back();" class="btn btn-danger"><li class="fa fa-long-arrow-up"></li></a>
                    </form>
                    <div class="clearfix" style="margin-bottom: 10px;"></div>
                    <div id="ajax_return">
                    </div>
                </div>
            </section>
        </div>
    </div>
</section>
{/block}
{block name="footer"}
<script>
    $(document).ready(function(){
        var id="{$Request.param.id}";
        ajax_get_relation(id);
    });

    if (history.pushState) {
        window.addEventListener("popstate", function () {
            var id=location.href.split("?id=")[1];
            if(id==null){
                id="{$Request.param.id}";
            }
            ajax_get_relation(id);
        });
    }

    function push(id) {
        if(history.pushState){
            if(id != ""){
                var param = 'id='+id;
                var title=document.title;
                history.pushState({ title: title }, "", location.href.split("?")[0] + "?" + param);
            }
        }
        ajax_get_relation(id);
    }

    function ajax_get_relation(id){
        $.ajax({
            type : "POST",
            url:"/master/user/ajaxuserstree?id="+id,//+tab,
            success: function(data){
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
            }
        });
    };
</script>
{/block}